﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:orm="http://kadgen.com/KADORM.xsd" xmlns:kd="http://kadgen.com/Special.xsd" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://kadgen.com/KADORM.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:import namespace="http://kadgen.com/Special.xsd" />
  <xs:element name="MappingRoot">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="SQLFunctionReplacement">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="SQLFunction">
                <xs:complexType>
                  <xs:attribute name="Name" type="xs:string" use="required" />
                  <xs:attribute name="ReplaceWith" type="xs:string" use="required" />
                  <xs:attribute name="NETType" type="xs:string" use="required" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="UniqueNamespaces" />
        <xs:element name="Build">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="SPSet">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="RetrieveParameter">
                      <xs:complexType>
                        <xs:attribute name="Name" type="xs:string" use="required" />
                        <xs:attribute name="Column" type="xs:string" use="required" />
                        <xs:attribute name="Alias" type="xs:string" use="required" />
                        <xs:attribute name="UseForDesc" type="xs:boolean" use="required" />
                        <xs:attribute name="OriginalName" type="xs:string" use="required" />
                        <xs:attribute name="Caption" type="xs:string" use="required" />
                        <xs:attribute name="Ordinal" type="xs:unsignedByte" use="required" />
                        <xs:attribute name="AllowNulls" type="xs:boolean" use="required" />
                        <xs:attribute name="SQLType" type="xs:string" use="required" />
                        <xs:attribute name="NETType" type="xs:string" use="required" />
                        <xs:attribute name="IsPrimaryKey" type="xs:boolean" use="required" />
                        <xs:attribute name="UDTCatalog" type="xs:string" use="required" />
                        <xs:attribute name="UDTOwner" type="xs:string" use="required" />
                        <xs:attribute name="UDTName" type="xs:string" use="required" />
                        <xs:attribute name="IsAutoIncrement" type="xs:boolean" use="required" />
                        <xs:attribute name="IsComputed" type="xs:boolean" use="required" />
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="WhereClause">
                      <xs:complexType>
                        <xs:attribute name="Clause" type="xs:string" use="required" />
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="ForeignKeyTables">
                      <xs:complexType>
                        <xs:sequence minOccurs="0">
                          <xs:element maxOccurs="unbounded" name="ForeignKeyTable">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element maxOccurs="unbounded" name="ForeignKey">
                                  <xs:complexType>
                                    <xs:attribute name="ChildColumn" type="xs:string" use="required" />
                                    <xs:attribute name="ChildTable" type="xs:string" use="required" />
                                    <xs:attribute name="ChildObject" type="xs:string" use="required" />
                                    <xs:attribute name="ChildProperty" type="xs:string" use="required" />
                                    <xs:attribute name="ParentColumn" type="xs:string" use="required" />
                                    <xs:attribute name="ParentTable" type="xs:string" use="required" />
                                    <xs:attribute name="ParentObject" type="xs:string" use="required" />
                                    <xs:attribute name="ParentProperty" type="xs:string" use="required" />
                                    <xs:attribute name="Ordinal" type="xs:unsignedByte" use="required" />
                                  </xs:complexType>
                                </xs:element>
                              </xs:sequence>
                              <xs:attribute name="Name" type="xs:string" use="required" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="SetSelect">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element maxOccurs="unbounded" name="SetSelectColumn">
                            <xs:complexType>
                              <xs:attribute name="Name" type="xs:string" use="required" />
                              <xs:attribute name="IsPrimaryKey" type="xs:boolean" use="required" />
                              <xs:attribute name="Column" type="xs:string" use="required" />
                              <xs:attribute name="TableName" type="xs:string" use="required" />
                              <xs:attribute name="SQLType" type="xs:string" use="required" />
                              <xs:attribute name="BaseNETType" type="xs:string" use="required" />
                              <xs:attribute name="NETType" type="xs:string" use="required" />
                              <xs:attribute name="IsAutoIncrement" type="xs:boolean" use="required" />
                            </xs:complexType>
                          </xs:element>
                          <xs:element minOccurs="0" maxOccurs="unbounded" name="Join">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="JoinKey">
                                  <xs:complexType>
                                    <xs:attribute name="LeftColumn" type="xs:string" use="required" />
                                    <xs:attribute name="RightColumn" type="xs:string" use="required" />
                                    <xs:attribute name="SQLType" type="xs:string" use="required" />
                                    <xs:attribute name="IsAutoIncrement" type="xs:boolean" use="required" />
                                    <xs:attribute name="LeafKeyIsPrimary" type="xs:boolean" use="required" />
                                  </xs:complexType>
                                </xs:element>
                              </xs:sequence>
                              <xs:attribute name="Type" type="xs:string" use="required" />
                              <xs:attribute name="LeftTable" type="xs:string" use="required" />
                              <xs:attribute name="RightTable" type="xs:string" use="required" />
                              <xs:attribute name="RightAlias" type="xs:string" use="required" />
                              <xs:attribute name="LeftOriginalName" type="xs:string" use="required" />
                              <xs:attribute name="LeftAlias" type="xs:string" use="required" />
                              <xs:attribute name="RightOriginalName" type="xs:string" use="required" />
                              <xs:attribute name="JoinStyle" type="xs:string" use="required" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="TableName" type="xs:string" use="required" />
                        <xs:attribute name="Schema" type="xs:string" use="required" />
                      </xs:complexType>
                    </xs:element>
                    <xs:element maxOccurs="unbounded" name="BuildRecordset">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="WhereClause">
                            <xs:complexType>
                              <xs:attribute name="Clause" type="xs:string" use="required" />
                            </xs:complexType>
                          </xs:element>
                          <xs:element minOccurs="0" maxOccurs="unbounded" name="Join">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="JoinKey">
                                  <xs:complexType>
                                    <xs:attribute name="LeftColumn" type="xs:string" use="required" />
                                    <xs:attribute name="RightColumn" type="xs:string" use="required" />
                                    <xs:attribute name="SQLType" type="xs:string" use="required" />
                                    <xs:attribute name="IsAutoIncrement" type="xs:boolean" use="required" />
                                    <xs:attribute name="LeafKeyIsPrimary" type="xs:boolean" use="required" />
                                  </xs:complexType>
                                </xs:element>
                              </xs:sequence>
                              <xs:attribute name="Type" type="xs:string" use="required" />
                              <xs:attribute name="LeftTable" type="xs:string" use="required" />
                              <xs:attribute name="RightTable" type="xs:string" use="required" />
                              <xs:attribute name="RightAlias" type="xs:string" use="required" />
                              <xs:attribute name="LeftOriginalName" type="xs:string" use="required" />
                              <xs:attribute name="LeftAlias" type="xs:string" use="required" />
                              <xs:attribute name="RightOriginalName" type="xs:string" use="required" />
                              <xs:attribute name="JoinStyle" type="xs:string" use="required" />
                            </xs:complexType>
                          </xs:element>
                          <xs:element maxOccurs="unbounded" name="BuildTable">
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element maxOccurs="unbounded" name="BuildColumn">
                                  <xs:complexType>
                                    <xs:attribute name="Name" type="xs:string" use="required" />
                                    <xs:attribute name="Column" type="xs:string" use="required" />
                                    <xs:attribute name="Alias" type="xs:string" use="required" />
                                    <xs:attribute name="UseForDesc" type="xs:boolean" use="required" />
                                    <xs:attribute name="OriginalName" type="xs:string" use="required" />
                                    <xs:attribute name="Caption" type="xs:string" use="required" />
                                    <xs:attribute name="Ordinal" type="xs:unsignedByte" use="required" />
                                    <xs:attribute name="AllowNulls" type="xs:boolean" use="required" />
                                    <xs:attribute name="SQLType" type="xs:string" use="required" />
                                    <xs:attribute name="NETType" type="xs:string" use="required" />
                                    <xs:attribute name="IsPrimaryKey" type="xs:boolean" use="required" />
                                    <xs:attribute name="UDTCatalog" type="xs:string" use="required" />
                                    <xs:attribute name="UDTOwner" type="xs:string" use="required" />
                                    <xs:attribute name="UDTName" type="xs:string" use="required" />
                                    <xs:attribute name="IsAutoIncrement" type="xs:boolean" use="required" />
                                    <xs:attribute name="IsComputed" type="xs:boolean" use="required" />
                                    <xs:attribute name="MaxLength" type="xs:unsignedShort" use="optional" />
                                    <xs:attribute name="MS_Description" type="xs:string" use="optional" />
                                    <xs:attribute name="IsLocalizedProperty" type="xs:boolean" use="optional" />
                                    <xs:attribute name="test5" type="xs:string" use="optional" />
                                    <xs:attribute name="test6" type="xs:string" use="optional" />
                                    <xs:attribute name="test7" type="xs:string" use="optional" />
                                  </xs:complexType>
                                </xs:element>
                              </xs:sequence>
                              <xs:attribute name="Ordinal" type="xs:unsignedByte" use="required" />
                              <xs:attribute name="TableName" type="xs:string" use="required" />
                              <xs:attribute name="OriginalName" type="xs:string" use="required" />
                              <xs:attribute name="Name" type="xs:string" use="required" />
                              <xs:attribute name="JoinStyle" type="xs:string" use="required" />
                              <xs:attribute name="RightAlias" type="xs:string" use="required" />
                              <xs:attribute name="Schema" type="xs:string" use="required" />
                            </xs:complexType>
                          </xs:element>
                          <xs:element minOccurs="0" maxOccurs="unbounded" name="ChildKey">
                            <xs:complexType>
                              <xs:attribute name="ChildColumn" type="xs:string" use="required" />
                              <xs:attribute name="ChildTable" type="xs:string" use="required" />
                              <xs:attribute name="ChildAlias" type="xs:string" use="required" />
                              <xs:attribute name="ChildObject" type="xs:string" use="required" />
                              <xs:attribute name="ChildProperty" type="xs:string" use="required" />
                              <xs:attribute name="ParentColumn" type="xs:string" use="required" />
                              <xs:attribute name="ParentTable" type="xs:string" use="required" />
                              <xs:attribute name="ParentAlias" type="xs:string" use="required" />
                              <xs:attribute name="ParentObject" type="xs:string" use="required" />
                              <xs:attribute name="ParentProperty" type="xs:string" use="required" />
                            </xs:complexType>
                          </xs:element>
                          <xs:element maxOccurs="unbounded" name="TableColumn">
                            <xs:complexType>
                              <xs:attribute name="Name" type="xs:string" use="required" />
                              <xs:attribute name="TableName" type="xs:string" use="required" />
                              <xs:attribute name="Column" type="xs:string" use="required" />
                              <xs:attribute name="Alias" type="xs:string" use="required" />
                              <xs:attribute name="UseForDesc" type="xs:boolean" use="required" />
                              <xs:attribute name="OriginalName" type="xs:string" use="required" />
                              <xs:attribute name="Caption" type="xs:string" use="required" />
                              <xs:attribute name="Ordinal" type="xs:unsignedByte" use="required" />
                              <xs:attribute name="AllowNulls" type="xs:boolean" use="required" />
                              <xs:attribute name="SQLType" type="xs:string" use="required" />
                              <xs:attribute name="NETType" type="xs:string" use="required" />
                              <xs:attribute name="MaxLength" type="xs:unsignedShort" use="required" />
                              <xs:attribute name="IsPrimaryKey" type="xs:boolean" use="required" />
                              <xs:attribute name="UDTCatalog" type="xs:string" use="required" />
                              <xs:attribute name="UDTOwner" type="xs:string" use="required" />
                              <xs:attribute name="UDTName" type="xs:string" use="required" />
                              <xs:attribute name="IsAutoIncrement" type="xs:boolean" use="required" />
                              <xs:attribute name="IsComputed" type="xs:boolean" use="required" />
                              <xs:attribute name="Precision" type="xs:unsignedByte" use="required" />
                              <xs:attribute name="Scale" type="xs:unsignedByte" use="required" />
                              <xs:attribute name="Schema" type="xs:string" use="required" />
                              <xs:attribute name="TableAlias" type="xs:string" use="required" />
                              <xs:attribute name="JoinBaseRootKey" type="xs:boolean" use="required" />
                              <xs:attribute name="JoinBaseLeafKey" type="xs:boolean" use="required" />
                              <xs:attribute name="MS_Description" type="xs:string" use="optional" />
                              <xs:attribute name="IsLocalizedProperty" type="xs:boolean" use="optional" />
                              <xs:attribute name="test5" type="xs:string" use="optional" />
                              <xs:attribute name="test6" type="xs:string" use="optional" />
                              <xs:attribute name="test7" type="xs:string" use="optional" />
                            </xs:complexType>
                          </xs:element>
                          <xs:element minOccurs="0" name="OrderBy">
                            <xs:complexType>
                              <xs:attribute name="Name" type="xs:string" use="required" />
                              <xs:attribute name="Ordinal" type="xs:unsignedByte" use="required" />
                              <xs:attribute name="SortOrder" type="xs:string" use="optional" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="Name" type="xs:string" use="required" />
                        <xs:attribute name="InsertPriority" type="xs:unsignedByte" use="required" />
                        <xs:attribute name="ChildFlag" type="xs:unsignedByte" use="required" />
                        <xs:attribute name="ChildName" type="xs:string" use="required" />
                        <xs:attribute name="ChildSPSet" type="xs:string" use="optional" />
                        <xs:attribute name="TempTableName" type="xs:string" use="optional" />
                        <xs:attribute ref="kd:Distinct" use="optional" />
                      </xs:complexType>
                    </xs:element>
                    <xs:element maxOccurs="unbounded" name="RunSP">
                      <xs:complexType>
                        <xs:sequence minOccurs="0">
                          <xs:element maxOccurs="unbounded" name="RunSPParam">
                            <xs:complexType>
                              <xs:attribute name="Name" type="xs:string" use="required" />
                              <xs:attribute name="Column" type="xs:string" use="required" />
                              <xs:attribute name="Table" type="xs:string" use="required" />
                              <xs:attribute name="OriginalTable" type="xs:string" use="required" />
                              <xs:attribute name="SQLType" type="xs:string" use="required" />
                              <xs:attribute name="NETType" type="xs:string" use="required" />
                              <xs:attribute name="IsPrimaryKey" type="xs:boolean" use="required" />
                              <xs:attribute name="IsAutoIncrement" type="xs:boolean" use="required" />
                              <xs:attribute name="AllowNulls" type="xs:boolean" use="required" />
                              <xs:attribute name="MaxLength" type="xs:unsignedShort" use="optional" />
                            </xs:complexType>
                          </xs:element>
                          <xs:element minOccurs="0" maxOccurs="unbounded" name="TableColumn">
                            <xs:complexType>
                              <xs:attribute name="Name" type="xs:string" use="required" />
                              <xs:attribute name="TableName" type="xs:string" use="required" />
                              <xs:attribute name="Column" type="xs:string" use="required" />
                              <xs:attribute name="Alias" type="xs:string" use="required" />
                              <xs:attribute name="UseForDesc" type="xs:boolean" use="required" />
                              <xs:attribute name="OriginalName" type="xs:string" use="required" />
                              <xs:attribute name="Caption" type="xs:string" use="required" />
                              <xs:attribute name="Ordinal" type="xs:byte" use="required" />
                              <xs:attribute name="AllowNulls" type="xs:boolean" use="required" />
                              <xs:attribute name="SQLType" type="xs:string" use="required" />
                              <xs:attribute name="NETType" type="xs:string" use="required" />
                              <xs:attribute name="MaxLength" type="xs:unsignedByte" use="required" />
                              <xs:attribute name="IsPrimaryKey" type="xs:boolean" use="required" />
                              <xs:attribute name="UDTCatalog" type="xs:string" use="required" />
                              <xs:attribute name="UDTOwner" type="xs:string" use="required" />
                              <xs:attribute name="UDTName" type="xs:string" use="required" />
                              <xs:attribute name="IsAutoIncrement" type="xs:boolean" use="required" />
                              <xs:attribute name="IsComputed" type="xs:boolean" use="required" />
                              <xs:attribute name="Precision" type="xs:unsignedByte" use="required" />
                              <xs:attribute name="Scale" type="xs:unsignedByte" use="required" />
                              <xs:attribute name="Schema" type="xs:string" use="required" />
                              <xs:attribute name="TableAlias" type="xs:string" use="required" />
                              <xs:attribute name="JoinBaseRootKey" type="xs:boolean" use="required" />
                              <xs:attribute name="JoinBaseLeafKey" type="xs:boolean" use="required" />
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="Name" type="xs:string" use="required" />
                        <xs:attribute name="Task" type="xs:string" use="required" />
                        <xs:attribute name="Alternate" type="xs:boolean" use="optional" />
                        <xs:attribute name="TempParentTableName" type="xs:string" use="optional" />
                        <xs:attribute name="TempChildTableName" type="xs:string" use="optional" />
                        <xs:attribute name="ParentObjectName" type="xs:string" use="optional" />
                        <xs:attribute name="ForeignKeyName" type="xs:string" use="optional" />
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="Name" type="xs:string" use="required" />
                  <xs:attribute name="ObjectName" type="xs:string" use="required" />
                  <xs:attribute name="TableName" type="xs:string" use="required" />
                  <xs:attribute name="OriginalName" type="xs:string" use="required" />
                  <xs:attribute name="Generate" type="xs:string" use="required" />
                  <xs:attribute name="NoGenStoredProc" type="xs:boolean" use="required" />
                  <xs:attribute name="Schema" type="xs:string" use="required" />
                  <xs:attribute name="IsChild" type="xs:boolean" use="required" />
                  <xs:attribute name="IsParent" type="xs:boolean" use="required" />
                  <xs:attribute name="IsMultiParentChild" type="xs:boolean" use="required" />
                  <xs:attribute name="NoChildren" type="xs:boolean" use="optional" />
                  <xs:attribute name="HasSelfJoin" type="xs:boolean" use="optional" />
                  <xs:attribute ref="kd:AllowListAll" use="optional" />
                  <xs:attribute name="test2" type="xs:string" use="optional" />
                  <xs:attribute name="test3" type="xs:string" use="optional" />
                  <xs:attribute name="test4" type="xs:string" use="optional" />
                  <xs:attribute ref="kd:AllowAll" use="optional" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="MapDataStructure" type="xs:string" use="required" />
            <xs:attribute name="Name" type="xs:string" use="required" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="MapDataStructure" type="xs:string" use="required" />
      <xs:attribute name="TransactionType" type="xs:string" use="required" />
      <xs:attribute name="Namespace" type="xs:string" use="required" />
      <xs:attribute name="TransactionForRetrieve" type="xs:boolean" use="required" />
      <xs:attribute name="RetrievePattern" type="xs:string" use="required" />
      <xs:attribute name="SetSelectPattern" type="xs:string" use="required" />
      <xs:attribute name="CreatePattern" type="xs:string" use="required" />
      <xs:attribute name="UpdatePattern" type="xs:string" use="required" />
      <xs:attribute name="DeletePattern" type="xs:string" use="required" />
      <xs:attribute name="Generate" type="xs:string" use="required" />
      <xs:attribute name="CollectionType" type="xs:string" use="required" />
    </xs:complexType>
  </xs:element>
</xs:schema>